<?php
namespace Admin\Controller;
use Think\Controller;
class UserController extends CommonController {
	public function index() {
		if(IS_POST){
			$UserId=I('post.search',0,'int');
			if($UserId==0){
				$UserName=I('post.search');
				$where=array();
				$where['UserName'] = array('like', "%$UserName%");
			}
			else{
				$where="UserId=$UserId";
			}
		}
		//获得数据
		$data = M('user')->field('UserId,UserName,Phone,Email,Address')->where($where)->select();
		//视图
		$this->assign("data",$data);
		$this->display();
	}
}